package com.facefun.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.facefun.service.IService;
import com.facefun.util.MyMapper;

public class BaseService<T> implements IService<T> {

	@Autowired
	MyMapper<T> mapper;
	
	@Override
	public int save(T entity) {
		return mapper.insertSelective(entity);
	}

	@Override
	public int updateNotNull(T entity) {
		return mapper.updateByPrimaryKeySelective(entity);
	}

	@Override
	public int deleteByKey(Object key) {
		return mapper.deleteByPrimaryKey(key);
	}

	@Override
	public List<T> selectAll() {
		return mapper.selectAll();
	}

	@Override
	public T selectByPrimaryKey(Object key) {
		return mapper.selectByPrimaryKey(key);
	}

	@Override
	public T selectOne(T entity) {
		return mapper.selectOne(entity);
	}

}
